<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">

    <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-block">
            <input type="hidden" name="id" id="id" value="{$manager.id}">
            <input type="text" name="account" id="account" required  lay-verify="required" placeholder="" autocomplete="off" class="layui-input" value="{$manager.account}" {if $manager}disabled{/if}>
            {if !$manager}
            <div class="layui-form-mid layui-word-aux">默认密码：123456</div>
            {/if}
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="checkbox" name="status" value="1" lay-skin="switch" lay-text="正常|禁用" {if $manager.status == 1}checked{/if}>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            <select name="role_id" lay-search {if $manager}disabled{/if} required lay-verify="required" lay-filter="role">
                <option value="">选择角色</option>
                {foreach $roles as $k => $v}
                <option value="{$v.id}" {if $manager.role_id == $v.id}selected{/if}>{$v.title}</option>
                {/foreach}
            </select>
        </div>
    </div>


    <div class="layui-form-item ebItem {if $manager.role.alias != 'agent'}layui-hide{/if}">
        <label class="layui-form-label">允许提现</label>
        <div class="layui-input-block">
            <input type="radio" name="allow_cache" value="1" title="是"  {if !$manager || $manager.allow_cache == 1}checked{/if}>
            <input type="radio" name="allow_cache" value="0" title="否"  {if $manager && $manager.allow_cache == 0}checked{/if}>
        </div>
    </div>


    <div class="layui-form-item ebItem {if $manager.role.alias != 'agent'}layui-hide{/if}">
        <label class="layui-form-label">上级商务</label>
        <div class="layui-input-block">
            <select name="eb_id" lay-search>
                <option value="0">选择商务</option>
                {foreach $ebs as $k => $v}
                <option value="{$v.id}" {if $manager.parent_id == $v.id}selected{/if}>{$v.account}</option>
                {/foreach}
            </select>
        </div>
    </div>


    <div class="layui-form-item {if $manager.role.alias != 'channel'}layui-hide{/if}" id="agentItem" >
        <label class="layui-form-label">上级代理</label>
        <div class="layui-input-block">
            <select name="agent_id" lay-search {if $manager}disabled{/if}>
            <option value="0">选择代理</option>
            {foreach $agents as $k => $v}
                <option value="{$v.id}" {if $manager.parent_id == $v.id}selected{/if}>{$v.account}</option>
            {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item {if $manager.role.alias != 'channel' and $manager.role.alias != 'agent' }layui-hide{/if}" id="scaleItem" >
        <label class="layui-form-label">内容等级</label>
        <div class="layui-input-block">
            <select name="scale" lay-search {if $manager}disabled{/if}>
                <option value="">选择</option>
                <option value="C" {if $manager.scale == 'C'}selected{/if}>C级</option>
                <option value="B" {if $manager.scale == 'B'}selected{/if}>B级</option>
                <option value="A" {if $manager.scale == 'A'}selected{/if}>A级</option>
                <option value="S" {if $manager.scale == 'S'}selected{/if}>S级</option>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux" style="margin-left: 109px;">例：C级（正常） B级（暧昧） A级（乡村） C级（无限制）</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">具体描述</label>
        <div class="layui-input-block">
            <textarea type="text" name="remarks" id="remarks"  autocomplete="off" class="layui-textarea">{$manager.remarks}</textarea>
        </div>
    </div>

    <div class="layui-form-item layui-hide">
        <button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
    </div>
</div>
<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function(){
        var $ = layui.$
            ,form = layui.form;

        form.on('select(role)', function(data){
            if (data.value == 5){
                $('.ebItem').removeClass('layui-hide');
                $('#scaleItem').removeClass('layui-hide');
            }else {
                $('.ebItem').addClass('layui-hide');
            }
            if (data.value == 9){
                $('#agentItem').removeClass('layui-hide');
                $('#scaleItem').removeClass('layui-hide');
            }else {
                $('#agentItem').addClass('layui-hide');

            }

            if(data.value != 9 && data.value != 5)
            {
                $('#scaleItem').addClass('layui-hide');
            }
        });
    })

</script>
</body>
</html>